<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>新恩数造</title>
    <link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico">
    <!-- Font Icon -->
    <link rel="stylesheet" type="text/css" href="static/css/opensans-font.css">
    <link rel="stylesheet" type="text/css" href="static/fonts/line-awesome/css/line-awesome.min.css">
    <!-- Main css -->
    <link rel="stylesheet" href="static/css/style.css"/>
    <link rel="stylesheet" href="static/css/toast.style.css">
</head>
<body style="background: linear-gradient(45deg, rgba(35, 136, 219, 0.90) 15%, rgba(99, 99, 99, 0.90) 100%); ">
<div class="page-content">
    <div class="form-v4-content">
        <div class="form-left">
            <h2>新恩数造</h2>
            <p class="text-2"><span>低代码平台化:</span> 专注业务领域，解放生产力，避免重复开发.</p>
            <p class="text-2"><span>组件化:</span> 50种常用组件，让您轻松处理数据库、接口、文件等形式的数据.</p>
            <p class="text-2"><span>图形化:</span> 随时随刻在线编辑你的etl脚本.</p>
            <p class="text-2"><span>版本控制:</span> 发布留痕，快速恢复线上任务.</p>
            <p class="text-2"><span>定时调度:</span> 根据需求随意编排etl任务.</p>
            <p class="text-2"><span>数据隔离:</span> 多租户设计保障您的数据源、设计脚本、业务数据安全.</p>
            <p class="text-2"><span>日志追踪:</span> 查看etl任务历史日志，帮助您定位分析数据问题.</p>
            <p class="text-2"><span>项目分享:</span> 便于将项目分享给组外人员学习、交流.</p>
            <p class="text-2"><span>运行监控:</span> 时刻监控服务器运行状态，便于您调整计划任务.</p>
        </div>
        <form id="registryForm" class="form-detail" method="post">
            <h2>新恩数造</h2>
            <div class="form-row">
                <label for="company">公司</label>
                <input type="text" name="company" id="company" class="input-text" required>
            </div>
            <div class="form-group">
                <div class="form-row form-row-1">
                    <label for="firstName">姓</label>
                    <input type="text" name="firstName" id="firstName" class="input-text" required>
                </div>
                <div class="form-row form-row-1">
                    <label for="lastName">名</label>
                    <input type="text" name="lastName" id="lastName" class="input-text" required>
                </div>
            </div>
            <div class="form-group">
                <div class="form-row form-row-1">
                    <label for="nick">昵称</label>
                    <input type="text" name="nick" id="nick" class="input-text" required>
                </div>
                <div class="form-row form-row-1">
                    <label for="mobile">手机号（即账号）</label>
                    <input type="text" name="mobile" id="mobile" class="input-text"
                           placeholder="推荐真实号码，后期有彩蛋" required>
                </div>
            </div>
            <div class="form-row">
                <label for="email">邮箱地址</label>
                <input type="email" name="email" id="email" class="input-text"
                       pattern="[^@]+@[^@]+.[a-zA-Z]{2,6}" required>
            </div>
            <div class="form-group">
                <div class="form-row form-row-1 ">
                    <label for="password">密码</label>
                    <input type="password" name="password" id="password" class="input-text" required>
                </div>
                <div class="form-row form-row-1">
                    <label for="confirmPassword">请再次输入密码</label>
                    <input type="password" name="confirmPassword" id="confirmPassword" class="input-text" required>
                </div>
            </div>
            <div class="form-row-last">
                <input name="register" class="register" value="注册" type="submit">
                <a href="https://console.nxin.online" class="account">已有账号</a>
            </div>
        </form>
    </div>
</div>
<script src="static/js/jquery-1.11.1.min.js"></script>
<script src="static/js/jquery.validate.min.js"></script>
<script src="static/js/jquery.form.min.js" type="text/javascript"></script>
<script src="static/js/toast.script.js"></script>
<script>
    // just for the demos, avoids form submit
    jQuery.validator.setDefaults({
        debug: true,
        success: function (label) {
            label.attr('id', 'valid');
        },
    });
    $("#registryForm").validate({
        rules: {
            password: "required",
            confirmPassword: {
                equalTo: "#password"
            }
        },
        messages: {
            company: {
                required: "请填入有效的公司名称"
            },
            firstName: {
                required: "请填入姓"
            },
            lastName: {
                required: "请填入名"
            },
            email: {
                required: "请填入邮箱"
            },
            mobile: {
                required: "请填入手机号码"
            },
            nick: {
                required: "请填入昵称"
            },
            password: {
                required: "请填入密码"
            },
            confirmPassword: {
                required: "请填入二次确认密码",
                equalTo: "两次密码不匹配，请再次填入"
            }
        },
        submitHandler: function (form) {
            debugger
            var values = {
                company: $('#company').val(),
                nick: $('#nick').val(),
                firstName: $('#firstName').val(),
                lastName: $('#lastName').val(),
                mobile: $('#mobile').val(),
                email: $('#email').val(),
                password: $('#password').val()
            };
            $.ajax({
                type: "POST",
                contentType: "application/json;charset=utf-8",
                data: JSON.stringify(values),
                dataType: "json",
                success: function () {
                    window.location.href = 'https://console.nxin.online';
                },
                error: function (err) {
                    if (err.status === 10003) {
                        $.Toast("错误", "手机号（账号）已存在.", "error", {
                            stack: false,
                            has_icon: true,
                            has_close_btn: true,
                            fullscreen: false,
                            timeout: 3000,
                            sticky: false,
                            has_progress: true,
                            rtl: false,
                            position_class: "toast-bottom-right"
                        });
                    } else if (err.status === 10004) {
                        $.Toast("错误", "手机号（账号）不可用.", "error", {
                            stack: false,
                            has_icon: true,
                            has_close_btn: true,
                            fullscreen: false,
                            timeout: 3000,
                            sticky: false,
                            has_progress: true,
                            rtl: false,
                            position_class: "toast-bottom-right"
                        });
                    } else if (err.status === 10005) {
                        $.Toast("错误", "用户名密码错误.", "error", {
                            stack: false,
                            has_icon: true,
                            has_close_btn: true,
                            fullscreen: false,
                            timeout: 3000,
                            sticky: false,
                            has_progress: true,
                            rtl: false,
                            position_class: "toast-bottom-right"
                        });
                    } else if (err.status === 10006) {
                        $.Toast("错误", "手机号（账号）已存在.", "error", {
                            stack: false,
                            has_icon: true,
                            has_close_btn: true,
                            fullscreen: false,
                            timeout: 3000,
                            sticky: false,
                            has_progress: true,
                            rtl: false,
                            position_class: "toast-bottom-right"
                        });
                    } else if (err.status === 400) {
                        $.Toast("错误", err.responseText, "error", {
                            stack: false,
                            has_icon: true,
                            has_close_btn: true,
                            fullscreen: false,
                            timeout: 3000,
                            sticky: false,
                            has_progress: true,
                            rtl: false,
                            position_class: "toast-bottom-right"
                        });
                    }
                }
            });
        }
    });
</script>
</body>
</html>